/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef LL_PWM_H
#define LL_PWM_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_ll_tim.h"
#include "stm32f4xx_ll_rcc.h"
#include "ll_gpio.h"
#include "ll_exti.h"
#include "stdio.h"
#include "stdint.h"

#if defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || \
    defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || \
    defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14)

#if defined(USE_FULL_LL_DRIVER)

#define PWM_MAX 31

typedef struct
{
    uint16_t pin;
    uint32_t channel;
    TIM_TypeDef *TIMx;
} PWM_Config;

uint8_t CalPwmParam(uint32_t rcc, uint16_t duty, uint32_t freq, uint16_t *pre_div, uint32_t *auto_reload, uint32_t *compare_val);
void LL_TIM_EnableClock(TIM_TypeDef *tim);
uint8_t LL_PWM_PIN_CONFIG(uint8_t port);

#endif /* USE_FULL_LL_DRIVER */

#endif /* defined (TIM1) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || \
            defined (TIM6) || defined (TIM7) || defined (TIM8) || defined (TIM9) || defined (TIM10) || \
            defined (TIM11) || defined (TIM12) || defined (TIM13) || defined (TIM14) */
#ifdef __cplusplus
}
#endif

#endif /* LL_PWM_H */